<?php
	class Home extends Controller{
		function Home(){
			parent::Controller();
		}
		function index(){
			//$this->output->cache(5);
			$this->load->model('forumModel');
			$this->load->model('messageModel');
			$data['forums']=$this->forumModel->select();
			foreach($data['forums'] as $key => $value){
				$data['forums'][$key]['message_num']=$this->messageModel->get_message_num_by_forum($value['id']);
				$data['forums'][$key]['message_num_today']=$this->messageModel->get_message_num_by_forum($value['id'],1);
				$data['forums'][$key]['last_message']=$this->messageModel->get_last_message_by_forum($value['id']);
			}
			//print_r($data);exit;
			$data['username']=$this->session->userdata('username');
			$this->load->view('home.php',$data);
		}
	}
?>